package com.wsoft.hr.pm.enums;

import lombok.Getter;

import static com.wsoft.hr.pm.constant.HrPmCodeConstant.HR_PM_PROCESS_STAGE_CHAIN_KEY;

/**
 * 考核流程-阶段枚举
 *
 * @author zhonglj
 * @return
 * @date 2025/3/1 10:54
 **/
@Getter
public enum HrProcessFlowStageEnum {
    /**
     * 指标制定
     */
    MAKE_TARGET("makeTarget", "指标制定", "hr-make-target", HR_PM_PROCESS_STAGE_CHAIN_KEY, null, null),

    /**
     * 指标评审
     */
    CHECK_TARGET("checkTarget", "指标评审", "hr-check-target", HR_PM_PROCESS_STAGE_CHAIN_KEY, "target_status", "target_business_code"),

    /**
     * 执行期
     */
    EXECUTION_PERIOD("executionPeriod", "执行期", "hr-execution-period", HR_PM_PROCESS_STAGE_CHAIN_KEY, null, null),

    /**
     * 绩效评分
     */
    PERFORMANCE_SCORE("performanceScore", "绩效评分", "hr-performance-score", HR_PM_PROCESS_STAGE_CHAIN_KEY, "score_status", "score_business_code"),

    /**
     * 结果确认
     */
    RESULT_CONFIRMATION("resultConfirmation", "结果确认", "hr-result-confirmation", HR_PM_PROCESS_STAGE_CHAIN_KEY, null, null),

    /**
     * 已完成
     */
    COMPLETED("completed", "已完成", "hr-completed", HR_PM_PROCESS_STAGE_CHAIN_KEY, null, null);

    private final String type;
    private final String desc;
    private final String processDefKey;
    private final String chainKey;
    private final String statusColumn;
    private final String businessColumn;


    HrProcessFlowStageEnum(String type, String desc, String processDefKey, String chainKey, String statusColumn, String businessColumn) {
        this.type = type;
        this.desc = desc;
        this.processDefKey = processDefKey;
        this.chainKey = chainKey;
        this.statusColumn = statusColumn;
        this.businessColumn = businessColumn;
    }

    /**
     * 根据类型标识获取枚举实例
     *
     * @param type 类型字符串
     * @return 匹配的枚举实例
     */
    public static HrProcessFlowStageEnum getEnum(String type) {
        for (HrProcessFlowStageEnum value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }

        return null;
    }
}
